package writtenexamination.boss;

import java.util.Arrays;

/**
 * @author cyt
 * @create 2020-10-15 下午 8:02
 */
public class Tc {
    public static void main(String[] args) {
        Tc tc = new Tc();
        int[] arr = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
        tc.calculateStatistics(arr);
    }

    public int[] calculateStatistics(int[] dataArr) {
        int min = Arrays.stream(dataArr).min().getAsInt();
        int max = Arrays.stream(dataArr).max().getAsInt();
        int n = dataArr.length;
        int[] temp = dataArr;
        Arrays.sort(temp);
        float ban = n / 2;
        int zhognweishu = (int) Math.ceil(ban);
        int index = (int) Math.ceil(n * 0.9);
        int[] ans = new int[4];
        ans[0] = temp[(int) zhognweishu - 1];
        ans[1] = min;
        ans[2] = max;
        ans[3] = temp[index - 1];
        return ans;
    }
}
